<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>方法</title>
</head>
<body>
    <div id="app">
        当前为:{{age}}
        <button v-on:click="add()">点我变大</button>
    </div>

    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el:"#app",
            data:{
                age:18,//方法名称和属性名称不能一致
            },
            methods:{
                add(){
                    this.age ++;
                }
            },
            created() {
                this.age = 19;
            },
            mounted() {//第一次渲染完成执行
                this.age = 20;
            }

        });
    </script>

</body>
</html>